/*!
\copyright  Copyright (c) 2024 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\ingroup    adk_test_common
\brief      Interface for common ANC testing functions.
*/

/*! @{ */

#ifndef ANC_AUDIO_CURATION_H
#define ANC_AUDIO_CURATION_H

/*!
    \brief Enable ANC with default mode configuration
*/
void appTestAudioCuration_SetAncEnable(void);

/*!
    \brief Disable ANC , stop current active mode
*/
void appTestAudioCuration_SetAncDisable(void);

/*!
    \brief Set Mode to requested mode

    \param req_mode requested mode
*/
void appTestAudioCuration_SetMode(uint8 req_mode);

/*!
    \brief Enable Tuninng Mode

    \param enable True: Enable False: Disable
*/
bool appTestAudioCuration_EnableTuning(bool enable);

/*!
    \brief Start Tuninng Mode

    \param mode tuning mode to start tuning for specified mode
*/
void appTestAudioCuration_EnterTuning(uint8 mode);

/*!
    \brief Stop Tuning Mode
*/
void appTestAudioCuration_ExitTuning(void);

/*!
    \brief Return current active mode
*/
uint8 appTestAudioCuration_GetCurrentMode(void);

/*  \brief Read a parameter from an audio capability

    From pydbg you can allocate memory for the address and use it as below
    param = apps.fw.call_vm.pnew("uint8_t[50]")
    apps.fw.call_vm.appTestAudioCuration_ReadCapParam(0x4209, 0, 0x8001000, 4, param)
    print(param)

    \param cap_id capability ID
    \param inst instance of the capability when the same capability is available multiple times in a graph
    \param pid parameter ID
    \param param_size size of parameter in bytes
    \param *param pointer to parameter
    \return TRUE when successful
*/
bool appTestAudioCuration_ReadCapParam(uint16 cap_id, uint16 inst, uint32_t pid, uint32_t param_size, uint8_t* param);

/*  \brief Returns the Operator ID for a given capability ID
    \param cap_id the capability id for which the operator ID is searched
    \param inst the instance. If multiple capability IDs are used in the graph, the instance 
           is used to get the wanted operator ID. Inst 0 looks for the first occurence of the 
           capability ID within the list of all capabilities of the graph, inst 1 looks for the
           second capability ID within the list.
    \return the found operator ID or OPID_NOT_FOUND
*/
uint16 appTestAudioCuration_GetOpId(uint16 cap_id, uint16 inst);

/*  \brief Write a parameter to an audio capability

    From pydbg you can allocate memory for the address and use it as below
    param = apps.fw.call_vm.pnew("uint8_t[50]")
    param[0] = 5
    apps.fw.call_vm.appTestAudioCuration_WriteCapParam(0x4209, 0, 0x8001000, 4, param)

    \param cap_id capability ID
    \param inst instance of the capability when the same capability is available multiple times in a graph
    \param pid parameter ID
    \param param_size size of parameter in bytes
    \param *param pointer to parameter
    \return TRUE when successful
*/
bool appTestAudioCuration_WriteCapParam(uint16 cap_id, uint16 inst, uint32_t pid, uint32_t param_size, uint8_t* param);

/*  \brief Write an ANC filter either to the Flash or to the capability
    \param param_size size of the whole payload in bytes
    \param *param pointer to the whole payload including ATS header
    \param permanent TRUE: Writing payload to Flash FALSE: Writing payload directly to capability
    \return TRUE when successful
*/
bool appTestAudioCuration_SetCalibration(uint32 param_size, uint8* param, bool permanent);

/*! @} */

#endif // ANC_AUDIO_CURATION_H